<!--
  @Descripttion:：全局header
  @Author：yejianbo
  @Date：2022年05月26日 12:35:40
-->
<template>
  <section class="header-com">
    <div class="center">
      <div class="logo">
        <img
          src="@/assets/images/home/logo.png"
          @click="loginOutFun()"
          v-imgError
          alt=""
        />
      </div>
    </div>
  </section>
</template>

<script>
import { mapMutations, mapState } from "vuex";
export default {
  // 组件名称
  name: "demo",
  // 组件状态值
  data() {
    return {
      headSearchType: "1", // 搜索类型 1 企业 2 职位 3 项目
      userInfo: {},
      showSearch: false,
      headKeyword: "",
    };
  },
  // 计算属性
  computed: {
    ...mapState(["USER_INFO"]),
  },
  watch: {
    USER_INFO: function (newValue, oldValue) {
      this.userInfo = newValue;
    },
  },
  created() {},
  // 组件方法
  methods: {
    ...mapMutations(["loginOut"]),
    loginOutFun() {
      this.$confirm("是否确认退出当前账号?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
      }).then(() => {
        this.loginOut(() => {
          this.$router.push({ name: "login" });
        });
      });
    },
  },
  /**
   * el 被新创建的 vm.$ el 替换，并挂载到实例上去之后调用该钩子。
   * 如果 root 实例挂载了一个文档内元素，当 mounted 被调用时 vm.$ el 也在文档内。
   */
  mounted() {},
};
</script>
<!-- Add "scoped" attribute to limit CSS to this component only -->
<style lang="less" scoped>
.header-com {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  min-width: 1000px;
  height: 80px;
  background-color: #fff;
  border-bottom: 1px solid #d4d6da;
  z-index: 999;
  box-shadow: 0px 4px 17px 0px rgba(0, 0, 0, 0.08);
  .center {
    position: relative;
    width: 1200px;
    height: 100%;
    margin: 0 auto;
    display: flex;
    justify-content: flex-start;
    flex-flow: row nowrap;
    background-color: #fff;
  }
  .logo {
    position: relative;
    height: 100%;
    display: flex;
    flex-flow: flex-start;
    align-items: center;
    img {
      position: relative;
      display: block;
      width: 57px;
      height: 52px;
    }
  }
}
</style>
